General
The C++ is an object-oriented general-purpose programming language. It was developed in the late 70s by Bjarne Stroustrup at Bell Labs and it was originally named "C with Classes". Its current name dates back to 1983 and is credited to Rick Mascitti. A joke goes that the name itself has a bug: due to the use of post-increment, which increments the value of the variable, but evaluates it to the unincremented value, it means that C++ is no better than C. The pre-increment ++C form should have been used instead, to show that C++ is better than C.[Wikipedia]
Due to its performance, efficiency and flexibility of use, it is the main programing language used in embedded systems, operating system kernels and performance-critical applications.[Wikipedia]
Standardization
There is ISO working group, JTC1/SC22/WG21, responsible for the C++ programming language standardization. So far, four versions of C++ were released:
- In 1998, the C++ is standardized for the first time as ISO/IEC 14882:1998. It is informally known as C++98.
- In 2003 a new version of the C++ standard was released, ISO/IEC 14882:2003, which fixed the problems which had been identified in C++98. It is known as C++03.
- In 2011 a major revision of the C++ standard was relesed: C++11, also known as C++0x. It was approved and released on the 12 August 2011 as ISO/IEC 14882:2011.
- In 2014 a new version was released, featuring mainly bug fixes and small improvements: C++14, also known as C++1y.
A new major C++ standard revision called C++17 is planned to be released in 2017.
Differences between C and C++
C++ was initially a proper superset of C. Although many people use the term C/C++, there are fundamental differences between the two. Both languages have evolved over time and they diverged a little bit, so currently we can consider them as different programming languages. Nevertheless, the compatibility between the two languages is always considered important and the following statements are true:
- Most C Programs can be compiled in C++ compiler.
- C++ expressions are the same as C expressions.
- All C operators are valid in C++.
The major differences between C and C++ are:
- C is function-driven, while C++ is object-driven. The C++ makes the mapping between the Data and the Functions much easier, using Objects.
- C follows the procedural programming paradigm, while C++ is a multi-paradigm language (allow working like in C, as well as using object-oriented paradigms, generic paradigms, etc).
- Ther are different operators added in C++ (new, delete, Class, etc) and data types (boolean).
- C allows implicit conversion from void* to other pointer types, but C++ does not, for type safety reasons.
- C++ allows the use of reference variables, while C does not.
- C++ defines the concept of virtual functions.
- Templates are available only in C++ and they represent a great addition to the language.
- C++ supports functions and operators overloading, which is considered to be one of the greatest features of C++.
- Namespaces are available only in C++ and are used to avoid name collision.
- Exception mechanism is available only in C++. It represents a very powerful mechanism of error handling.
- The Standard Library (STL): C have his own, but the C++ standard library is almost entirely (not IO streams) made of templates (containers and algorithms). This approach allows generating code only for what you use.
- Smart pointers (fully available in C++11) makes the memory management much easier in C++.